package com.sline.chario;

import java.io.*;

public class Demo3_Copy {
    public static void main(String[] args) throws IOException {
        // demo1();

        BufferedReader br = new BufferedReader(new FileReader("abc.txt"));
        BufferedWriter bw = new BufferedWriter(new FileWriter("xxx.txt"));

        int c;
        while ((c = br.read()) != -1) {
            bw.write(c);
        }

        br.close();
        bw.close();
    }

    private static void demo1() throws IOException {
        FileReader fr = new FileReader("abc.txt");
        FileWriter fw = new FileWriter("copy.txt");

        int a;
        while((a = fr.read()) != -1) {
            fw.write(a);
        }

        fr.close();
        fw.close();
    }
}
